package club.banyuan.blog.demo;

import cn.hutool.crypto.digest.BCrypt;
import cn.hutool.crypto.digest.DigestUtil;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

public class Md5Demo {

    public static void main(String[] args) {

//        for (int i = 0; i < 100000000; i++) {
//            System.out.println(i + " => " + DigestUtil.md5Hex("" + i));
//        }

        String password = "123456";
        System.out.println(BCrypt.hashpw(password));
        System.out.println(BCrypt.hashpw(password));

        boolean isOk = BCrypt.checkpw(password, "$2a$10$9NTaoJneA10abgVJ0xA8nOf0rmhVhUMnaCiYYS75L4coa6uIuS2vm");
        System.out.println(isOk);


        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        System.out.println(encoder.encode("1234"));
    }
}
